<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@page import="com.winexpress.util.SessionAttributes"%>
<%@page import="java.util.List"%>
<%@page import="com.winexpress.order.Wine"%>
<%@page import="java.util.ArrayList"%>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>wineXpress online shop</title>
        <link href="/WineXpressClient/resources/css/bootstrap.css" rel="stylesheet"/>
        <link href="/WineXpressClient/resources/css/modern-business.css" rel="stylesheet"/>
        <link href="/WineXpressClient/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
        <script src="/WineXpressClient/resources/js/bootstrap.js"></script>
        <script src="/WineXpressClient/resources/js/modern-business.js"></script>
        <script src="/WineXpressClient/resources/js/bootstrapValidator.js"></script>
    </head>
    <body>
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id))
                    return;
                js = d.createElement(s);
                js.id = id;
                js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));</script>
        <div id="top">
            <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="/WineXpressClient/initialization/index">WineXpress</a>
                    </div>
                    <div class="collapse navbar-collapse navbar-ex1-collapse">
                        <ul class="nav navbar-nav navbar-right">
                            <li><a href="/WineXpressClient/searchManagement/shop">Shop</a>
                            </li>
                            <li><a href="/WineXpressClient/common/contactPage">Contact</a>
                            </li>
                            <%if (session.getAttribute(SessionAttributes.USER_ID) != null && !(Boolean) session.getAttribute(SessionAttributes.IS_ADMIN)) { %>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Order / Account<b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <li class="dropdown-header">Order Management</li>
                                    <li><a href="/WineXpressClient/historyOrder/viewHistoryOrder" target="_blank">View Order History</a></li>
                                    <li class="divider"></li>
                                    <li class="dropdown-header">Account Management</li>
                                    <li><a href="/WineXpressClient/accountManagement/customerParticularResult">View Account Information</a></li>
                                    <li><a href="/WineXpressClient/customer/customerPaticular.jsp">Edit Particulars</a></li>
                                    <li><a href="/WineXpressClient/common/changePassword">Change Password</a></li>
                                    <li class="divider"></li>
                                    <li class="dropdown-header">Enquiry</li>
                                    <li><a href="/WineXpressClient/common/submitEnquiry">Create Enquiry&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></li> 
                                    <li><a href="/WineXpressClient/enquiryManagement/customerViewEnquiryPending">View Pending Enquiry</a></li> 
                                    <li><a href="/WineXpressClient/enquiryManagement/customerViewEnquiry">View Responded Enquiry</a></li> 
                                </ul>
                            </li>
                            <% }%>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Shopping Cart(<%=request.getParameter("itemsnum")%>)<b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <li><a href="/WineXpressClient/cart/viewCart">View Shopping Cart</a></li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Other Pages <b class="caret"></b></a>
                                <ul class="dropdown-menu">                           

                                    <li><a href="/WineXpressClient/common/adminSignIn">Staff Sign in</a></li>
                                </ul>
                            </li>
                            <% if (session.getAttribute(SessionAttributes.USER_ID) != null) {%>
                            <div class="navbar-form navbar-right">
                                <a href="/WineXpressClient/accountManagement/customerParticularResult" ><%= session.getAttribute(SessionAttributes.USER_FIRST_NAME)%></a>
                                &nbsp;&nbsp;
                                <a href="/WineXpressClient/logout/index" class="btn btn-success" role="button">Sign out</a>
                            </div>
                            <% } else {%>
                            <div class="navbar-form navbar-right">
                                <button class="btn btn-primary" data-toggle="modal" data-target="#login">Sign in</button>
                                <a href="/WineXpressClient/register.jsp" class="btn btn-success" role="button">Register</a>
                                <a href="/WineXpressClient/facebookSignin" ><img src="/WineXpressClient/resources/images/facebook.png" alt="Facebook"/></a>
                                <a href="/WineXpressClient/googleSignIn" ><img <img src="https://www.gstatic.com/images/icons/gplus-32.png" alt="Google"/></a>
                            </div>
                            <% }%>
                        </ul>
                    </div>
                </div>
            </nav>
            <div class="modal fade" id="login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel">Login</h4>
                        </div>
                        <div class="modal-body">
                            <form class="form-horizontal" role="form" action="/WineXpressClient/login/index" method="POST">
                                <div class="form-group">
                                    <label for="inputEmail" class="col-sm-2 control-label">Email</label>
                                    <div class="col-sm-10">
                                        <input type="email" class="form-control" name="inputEmail" placeholder="Email">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputPassword" class="col-sm-2 control-label">Password</label>
                                    <div class="col-sm-10">
                                        <input type="password" class="form-control" name="inputPassword" placeholder="Password">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label  class="col-sm-4 control-label"> </label>
                                    <div class="col-sm-10" style="padding-left: 115px;">
                                        <a href="/WineXpressClient/forgetPassword.jsp">Forget Password</a>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <button type="submit" class="btn btn-default">Sign in</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="header" style="position: absolute;  padding-top: 5%; width: 100%; height: 200px; z-index: 10; margin-left: auto; margin-right: auto;">
            <br/>
            <div style="display: block; margin-left: auto; margin-right: auto; width: 600px; height: 180px; background: rgba(256, 256, 256, 0.7); border-radius: 4%">
                <br/>
                <div class="logo_img">
                    <img alt="Site Name" style="display: block; margin-left: auto; margin-right: auto;" src="/WineXpressClient/resources/images/logo.png"/>
                </div>
                <br/>
                <div class="logo_img2">
                    <img alt="Site Name" style="display: block; margin-left: auto; margin-right: auto; background:" src="/WineXpressClient/resources/images/taste.png"/>
                </div>
            </div>
            <br/><br/><br/><br/><br/><br/><br/><br/><br/>
            <a class="btn btn-primary btn-lg active" role="button" style=" display: block; font-size: 18px; width: 150px; height: 50px; margin-left: auto; margin-right: auto;" href="/WineXpressClient/searchManagement/shop">Start Shopping</a>
        </div>
        <!--rolling-->        
        <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" style="height: 100%">
            <ol class="carousel-indicators" >
                <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
                <div class="item active">
                    <img src="/WineXpressClient/resources/images/slide1.jpg" style="width: 100%; height: 100%" />
                    <div class="carousel-caption">
                    </div>
                </div>
                <div class="item">
                    <img src="/WineXpressClient/resources/images/slide2.jpg"  style="width: 100%; height: 100%" />              
                    <div class="carousel-caption">
                    </div>
                </div>
                <div class="item">
                    <img src="/WineXpressClient/resources/images/slide3.jpg" style="width: 100%; height: 100%" />
                    <div class="carousel-caption">
                    </div>
                </div>
            </div>

            <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left"></span>
            </a>
            <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right"></span>
            </a>
        </div>
        <!--rolling-->
        <div class="section">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 text-center">
                        <h2>OUR BEST SELLERS OF THE MONTH</h2>
                        <hr>
                    </div>
                    <%  List<Wine> list = (List) session.getAttribute("bestSellersList");%>
                    <% if ((list != null) && (!list.isEmpty())) {
                            for (Object o : list) {
                                Wine w = (Wine) o;%>
                    <div class="col-lg-3 col-md-3 col-sm-3" style="border: solid 1px #ddd; margin-left: 5%; text-align: center;">
                        <a href="/WineXpressClient/products/productDetail?id=<%=w.getId()%>"><img class="img-responsive img-home-portfolio" class="img-responsive" style="margin-left: auto; margin-right: auto; vertical-align: middle;" src="<%=w.getImageUrl()%>"></a>
                        <a href="/WineXpressClient/products/productDetail?id=<%=w.getId()%>"><%=w.getName()%></a>
                    </div>
                    <%}
                    } else if (list == null) {%>
                    <h5>Please check this place later!</h5>
                    <script type="text/javascript">
                    window.location = "https://localhost:8080/WineXpressClient/initialization/index";
                    </script>
                    <% } %>
                </div>
            </div>
        </div>
        <div class="section-colored">
            <div class="container">
                <div class="row">
                    <div class="col-lg-7 col-md-7 col-sm-7">
                        <h2>Check Out Our Latest Promotion</h2>
                        <ul>
                            <li>Get more information about our marketing campaign</li>
                            <li>Subscribe promotion email</li>
                            <li>Like our page on Facebook</li>
                            <li>Enjoy more discounts</li>
                            <li>Share your favorite products on social media!</li>
                        </ul>
                    </div>
                    <div class="col-lg-5 col-md-5 col-sm-5">
                        <img class="img-responsive" src="/WineXpressClient/resources/images/promotion.jpg">
                    </div>
                </div>
            </div>
        </div>
        <div class="section">
            <div class="container">
                <div class="row">    
                    <div class="col-lg-7 col-md-7 col-sm-7">
                        <h2>Like Us on Facebook</h2>
                        <ul>
                            <li>Get More Promotion Information</li>
                            <li>Enjoy More Discounts</li>
                            <li>Share Your Favorite Wine With Friends</li>
                        </ul>
                    </div>
                    <div class="col-lg-5 col-md-5 col-sm-5">
                        <div class="fb-like-box" data-href="https://www.facebook.com/winexpress4227" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="true"></div>
                    </div>         
                </div>

            </div>
        </div>
        <div class="section-colored">
            <div class="container">
                <div class="row" style="alignment-adjust: central; text-align: center; width: 100%;">
                    <form class="form-horizontal" role="form" id="defaultForm" name="register" action="/WineXpressClient/subscribe/index" method="post">
                        <h3>Subscribe to Our Promotions:</h3>
                        <input type="text" class="form-control" name="email" placeholder="Email" style="text-align: center;"/>
                        <br/>
                        <button type="submit" class="btn btn-default">Submit</button>
                    </form>
                    <% Boolean subscribeResult = (Boolean) request.getAttribute("subscribeResult");
                        if (subscribeResult != null) {
                            if (subscribeResult) {%>
                    <script>
                        alert("You have successfully subscribed our promotions, please check your email for more details.");
                    </script>
                    <% } else {%>
                    <script>
                        alert("Fail to add new subscriber, please try again.");
                    </script>
                    <%}%>
                    <%}%>
                </div>
            </div>
        </div>
        <t:footer/>
        <script>
            (function(i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r;
                i[r] = i[r] || function() {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
                a = s.createElement(o),
                        m = s.getElementsByTagName(o)[0];
                a.async = 1;
                a.src = g;
                m.parentNode.insertBefore(a, m)
            })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

            ga('create', 'UA-49265652-2', 'winexpress6.tk');
            ga('send', 'pageview');

        </script>
    </body>
</html>